#pragma once
#include "HashTable.h"
namespace zzb
{
	template<class K>
	struct KeyOfSet
	{
		const K& operator()(const K& K)
		{
			return K;
		}

	};
	template<class K, class Hash = HashFuc<K>>
	class unordered_set
	{
	public:
		typedef typename HashBucket::HastTable<K, K, KeyOfSet<K>, Hash>::const_iterator iterator;
		typedef typename HashBucket::HastTable<K, K, KeyOfSet<K>, Hash>::const_iterator const_iterator;

		pair<iterator, bool> insert(const K& k)
		{
			auto ret = _ht.insert(k);
			return make_pair(iterator(ret.first._node, ret.first._pht, ret.first._hashi), ret.second);
		}
		const_iterator begin() const
		{
			return _ht.begin();
		}
		const_iterator end() const
		{
			return _ht.end();
		}
	private:
		HashBucket::HastTable<K, K, KeyOfSet<K>, Hash> _ht;
	};
	void TestMyOrderedSet()
	{
		unordered_set<int> s;
		s.insert(1);
		s.insert(11);
		s.insert(3);
		s.insert(12);
		s.insert(13);
		s.insert(2);
		s.insert(4);
		unordered_set<int>::iterator it = s.begin();
		while (it != s.end())
		{
			cout << *it << endl;
			++it;
		}
	}
}